﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShortcutMenu
{
    public static class Log
    {
        private static string Path = Directory.GetCurrentDirectory() + "/Log";
        private static string Name
        {
            get
            {
                var name = DateTime.Now.ToString("yyyyMMdd") + ".txt";
                if (!Directory.Exists(Path))
                    Directory.CreateDirectory(Path);
                if (!File.Exists(Path + '/' + name))
                    File.Create(Path + '/' + name).Close();
                return name;
            }
        }

        public static void Write(string str)
        {
            var name = Name;
            using (StreamWriter sw = new StreamWriter(Path + "/" + name, true))
            {

                sw.WriteLine(DateTime.Now + " : " + str);
            }
        }
    }
}
